Skip to content

[BUG FIX] Apply the per-geom density in MJCF asset. - #3269

Draft
Milotrince wants to merge 5 commits into
Genesis-Embodied-AI:mainfrom
Milotrince:mjcf-geom-density
Draft

[BUG FIX] Apply the per-geom density in MJCF asset.#3269
Milotrince wants to merge 5 commits into
Genesis-Embodied-AI:mainfrom
Milotrince:mjcf-geom-density

Conversation

@Milotrince

@Milotrince Milotrince commented Aug 25, 2026

Copy link
Copy Markdown
Member

Description

  • Apply density and mass from MJCF geom
  • A collision geom weighing nothing leaves the visual geoms to carry the link, as they already do
    for a link with no collision geometry.
  • The align anchor now weighs an unstated geom at the default density rather than unit density,
    so a link mixing stated and unstated geoms anchors at the right relative weights instead of
    being rejected as ambiguous.

With recompute_inertia=True this PR affects assets that author the Gym-style density="5": xml/ant.xml 97.33 -> 0.324 kg (Mujoco: 0.327), xml/one_tet.xml 1600 -> 13.3, xml/thin_box.xml 0.0096 -> 8e-05. Default options are unaffected: link masses are same on MJCFs with recompute_inertia=False.

Related Issue

Motivation and Context

An asset that states what its geoms are made of should be weighed by it whenever Genesis computes the mass itself.

How Has This Been / Can This Be Tested?

  • tests/rigid tests/parsers
  • tests/rigid/test_asset_loading.py::test_mjcf_authored_geom_density

Checklist:

  • I read the CONTRIBUTING document.
  • I followed the Submitting Code Changes section of CONTRIBUTING document.
  • I tagged the title correctly (including BUG FIX/FEATURE/MISC/BREAKING)
  • I updated the documentation accordingly or no change is needed.
  • I tested my changes and added instructions on how to test it for reviewers.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@Milotrince Milotrince changed the title [BUG FIX] Honor the per-geom density authored by an MJCF asset. [BUG FIX] Apply the per-geom density in MJCF asset. Aug 25, 2026
@Milotrince

Copy link
Copy Markdown
Member Author

@codex review

@github-actions

Copy link
Copy Markdown

🔴 Benchmark Regression Detected ➡️ Report

Comment on lines 1009 to 1011
# and estimated masses would make the anchor density-dependent, and a kinematic entity has no density
# to fall back on, so alignment could differ from the rigid counterpart. Require all-or-none and raise
# otherwise.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make sure to update the comment accordingly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants